Encapsulates the different functions used to manage Objects. Pointers to the Objects are stored in two lists:
- a doubly linked list: nodes
- an array: inventory
The NodeList nodes is mixed at every time step, and thus it can be used to access the objects in a random order, as necessary for Monte-Carlo.
The Inventory can be used to access objects directly.
Functions are used to manage:
- object creation: newProperty(), newObject().
- object lists: size(), add(), remove(), relink(), erase().
- object access: first(), find().
- simulation: step(), mix().
- I/O: readObject(), read(), write(), freeze(), thaw().
|
|
virtual void | freeze () |
| | transfer all nodes to list ice
|
| |
|
virtual void | thaw (bool erase) |
| | erase objects, or put them back in normal list
|
| |
|
| ObjectSet (Simul &s) |
| | creator
|
| |
|
virtual | ~ObjectSet () |
| | destructor
|
| |
|
virtual std::string | kind () const |
| | identifies the sort of objects stored in the set
|
| |
|
virtual Property * | newProperty (const std::string &kind, const std::string &name, Glossary &) const =0 |
| | create a new property for class kind with given name
|
| |
| virtual Object * | newObject (const std::string &kind, const std::string &name, Glossary &opt)=0 |
| | create a single new object with given Property More...
|
| |
| virtual ObjectList | newObjects (const std::string &kind, const std::string &name, Glossary &opt) |
| | create new objects, given Property and options in opt More...
|
| |
| virtual ObjectList | newPlacedObjects (const std::string &kind, const std::string &name, Glossary &opt) |
| | create new objects, translate and rotate them according to specifications in opt More...
|
| |
|
virtual Object * | newObjectT (const Tag, int prop_index)=0 |
| | create a new object from the corresponding tag (used for IO)
|
| |
|
virtual void | add (Object *) |
| | register Object, and add it at the end of the list
|
| |
|
void | add (ObjectList &) |
| | remove Object in ObjectList
|
| |
|
virtual void | remove (Object *) |
| | remove Object
|
| |
|
void | remove (ObjectList &) |
| | remove Object in ObjectList
|
| |
| virtual void | relink (Object *) |
| | unlink and relink object. This places it last in the list More...
|
| |
|
void | erase (Object *) |
| | remove Object, and delete it
|
| |
|
virtual void | erase () |
| | delete all Objects in list and forget all serial numbers
|
| |
|
virtual unsigned | size () const |
| | number of elements
|
| |
|
virtual void | mix () |
| | mix the order of elements in the doubly linked list nodes
|
| |
|
Object * | first () const |
| | first Object in the list
|
| |
| Object * | first (const Property *) const |
| | return an Object which has this property More...
|
| |
|
Object * | last () const |
| | last Object
|
| |
|
Object * | find (const Number n) const |
| | find Object of given serial-number (see Inventoried)
|
| |
| Object * | findObject (long n) const |
| | return Object with serial-number if ( n > 0 ) or object from the end of the list if ( n <= 0 ) More...
|
| |
|
virtual ObjectList | collect (bool(*func)(Object const *, void *), void *) const |
| | collect Object for which func(obj, val) == true
|
| |
| void | readObject (InputWrapper &, Tag, char pretag) |
| | read one Object from file More...
|
| |
|
virtual void | write (OutputWrapper &out) const |
| | write all Objects to file
|
| |
| ObjectList newObjects |
( |
const std::string & |
kind, |
|
|
const std::string & |
prop, |
|
|
Glossary & |
opt |
|
) |
| |
|
virtual |
This returns a list of Objects, that are not necessarily all of the same class. For example, the list may contain a Solid, and a bunch of attached Singles. The Objects are placed at the origin, and aligned with the X-axis. The Objects should be added to the Simul.
The default behavior is to call newObject()
Reimplemented in CoupleSet, SingleSet, FiberSet, OrganizerSet, BeadSet, SolidSet, and SphereSet.
| ObjectList newPlacedObjects |
( |
const std::string & |
kd, |
|
|
const std::string & |
nm, |
|
|
Glossary & |
opt |
|
) |
| |
|
virtual |
- This returns a list of Objects, that are not necessarily all of the same class. For example, the list may contain a Solid, and any number of attached Singles.
- These Objects are not yet linked in the Simul.
- They are placed and oriented in Space according to the options provided in 'opt'.
This calls newObjects()
new INTEGER CLASS NAME
{
position = POSITION
placement = PLACEMENT, SPACE_NAME
nb_trials = INTEGER
}
PLACEMENT can be:
- if placement = inside (default), it tries to find a place inside the Space
- if placement = anywhere, the position is returned
- if placement = outside, the object is created only if it is outside the Space
- if placement = surface, the position is projected on the edge of current Space
By default, the specifications are relative to the last Space that was defined, but a different space can be specified as second argument of PLACEMENT.
You can set the density of objects by setting nb_trials=1:
new 100 single grafted
{
position = ( rectangle 10 10 )
nb_trials = 1
}
This way an object will be created only if the position falls inside, and the density will be exactly 100/10*10 = 1.